#!/usr/bin/perl -w

use Data::Dumper;

my @ar;

while (<>) {

  next if ($_ =~ /^#/ || $_ =~ /^\s+$/);
  
  push @ar, $_;  
}

my %h;

foreach my $l ( sort @ar ) {

  $l =~ s/^\s+//g;

  my @d = split /\s/, $l;
  
  my $k = $d[0];
  
  if ( $h{$k} ) {
    push @{ $h{$k} }, $l;
  }
  else {
     $h{$k} = [$l];
  }

}

map { print @{ $h{$_} }, "\n" } sort{$a <=> $b} keys %h;

#print Dumper(%h);
